{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## 导入包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import geopandas as gpd\n",
    "import netCDF4 as nc\n",
    "\n",
    "from tqdm import tqdm\n",
    "from netCDF4 import num2date\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "from shapely.geometry import Point\n",
    "# from shapely.validation import make_valid\n",
    "\n",
    "import platform"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 加载NC文件"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [],
   "source": [
    "nc_data = nc.Dataset(\"lftx.sfc.2021.nc\")"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 处理NC数据"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "time_units = [temp_variable.units for temp_variable in nc_data.variables.values() if temp_variable.name == 'time'][0]\n",
    "# [pd.to_datetime(str(num2date(temp_time,units=time_units))) for temp_time in np.array(nc_data.variables['time'])]\n",
    "time_list = [num2date(temp_time, units=time_units).strftime('%Y-%m-%d') for temp_time in\n",
    "             np.array(nc_data.variables['time'])]\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-4-f07815a80910>:1: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.\n",
      "Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\n",
      "  lftx_data = np.array(nc_data.variables['lftx'])\n",
      "<ipython-input-4-f07815a80910>:4: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.\n",
      "Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\n",
      "  lon_data = np.array(nc_data.variables['lon'])\n",
      "<ipython-input-4-f07815a80910>:5: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.\n",
      "Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\n",
      "  lat_data = np.array(nc_data.variables['lat'])\n"
     ]
    }
   ],
   "source": [
    "lftx_data = np.array(nc_data.variables['lftx'])\n",
    "lftx_data = lftx_data[np.where([i == '2021-02-13' for i in time_list])[0][0], :, :]\n",
    "\n",
    "lon_data = np.array(nc_data.variables['lon'])\n",
    "lat_data = np.array(nc_data.variables['lat'])"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 读取json数据"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "outputs": [
    {
     "data": {
      "text/plain": "   adcode    name  childrenNum     level              parent  subFeatureIndex  \\\n0  110000     北京市         16.0  province  {'adcode': 100000}              0.0   \n1  120000     天津市         16.0  province  {'adcode': 100000}              1.0   \n2  130000     河北省         11.0  province  {'adcode': 100000}              2.0   \n3  140000     山西省         11.0  province  {'adcode': 100000}              3.0   \n4  150000  内蒙古自治区         12.0  province  {'adcode': 100000}              4.0   \n\n  adchar                                           geometry  \n0   None  MULTIPOLYGON (((117.34861 40.58114, 117.38988 ...  \n1   None  MULTIPOLYGON (((117.76560 39.40053, 117.84691 ...  \n2   None  MULTIPOLYGON (((117.46749 40.64974, 117.41267 ...  \n3   None  MULTIPOLYGON (((110.37926 34.60061, 110.42484 ...  \n4   None  POLYGON ((97.17290 42.79526, 97.37123 42.45708...  ",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>adcode</th>\n      <th>name</th>\n      <th>childrenNum</th>\n      <th>level</th>\n      <th>parent</th>\n      <th>subFeatureIndex</th>\n      <th>adchar</th>\n      <th>geometry</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>110000</td>\n      <td>北京市</td>\n      <td>16.0</td>\n      <td>province</td>\n      <td>{'adcode': 100000}</td>\n      <td>0.0</td>\n      <td>None</td>\n      <td>MULTIPOLYGON (((117.34861 40.58114, 117.38988 ...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>120000</td>\n      <td>天津市</td>\n      <td>16.0</td>\n      <td>province</td>\n      <td>{'adcode': 100000}</td>\n      <td>1.0</td>\n      <td>None</td>\n      <td>MULTIPOLYGON (((117.76560 39.40053, 117.84691 ...</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>130000</td>\n      <td>河北省</td>\n      <td>11.0</td>\n      <td>province</td>\n      <td>{'adcode': 100000}</td>\n      <td>2.0</td>\n      <td>None</td>\n      <td>MULTIPOLYGON (((117.46749 40.64974, 117.41267 ...</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>140000</td>\n      <td>山西省</td>\n      <td>11.0</td>\n      <td>province</td>\n      <td>{'adcode': 100000}</td>\n      <td>3.0</td>\n      <td>None</td>\n      <td>MULTIPOLYGON (((110.37926 34.60061, 110.42484 ...</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>150000</td>\n      <td>内蒙古自治区</td>\n      <td>12.0</td>\n      <td>province</td>\n      <td>{'adcode': 100000}</td>\n      <td>4.0</td>\n      <td>None</td>\n      <td>POLYGON ((97.17290 42.79526, 97.37123 42.45708...</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chinamap_data = gpd.read_file(filename=\"100000_中华人民共和国_full.json\")\n",
    "chinamap_data.head()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using matplotlib backend: MacOSX\n"
     ]
    }
   ],
   "source": [
    "% matplotlib\n",
    "fig, ax = plt.subplots(figsize=(6, 6))\n",
    "chinamap_data.iloc[:35, :].plot(ax=ax, color='black')\n",
    "plt.show()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "outputs": [
    {
     "data": {
      "text/plain": "0     False\n1     False\n2     False\n3     False\n4     False\n5     False\n6     False\n7     False\n8     False\n9     False\n10    False\n11    False\n12    False\n13    False\n14    False\n15    False\n16    False\n17    False\n18    False\n19    False\n20    False\n21    False\n22    False\n23    False\n24    False\n25    False\n26    False\n27    False\n28    False\n29    False\n30    False\n31    False\n32    False\n33    False\n34    False\ndtype: bool"
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "#\n",
    "# chinamap_data['geometry'].contains(Point(20, 40))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 处理地图数据"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "outputs": [
    {
     "data": {
      "text/plain": "(73, 144)"
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Lon_data, Lat_data = np.meshgrid(lon_data, lat_data)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "outputs": [
    {
     "data": {
      "text/plain": "    lon   lat    lftx\n0   0.0  90.0  30.475\n1   2.5  90.0  30.475\n2   5.0  90.0  30.475\n3   7.5  90.0  30.475\n4  10.0  90.0  30.475",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>lon</th>\n      <th>lat</th>\n      <th>lftx</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0.0</td>\n      <td>90.0</td>\n      <td>30.475</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2.5</td>\n      <td>90.0</td>\n      <td>30.475</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>5.0</td>\n      <td>90.0</td>\n      <td>30.475</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>7.5</td>\n      <td>90.0</td>\n      <td>30.475</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>10.0</td>\n      <td>90.0</td>\n      <td>30.475</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lftx_data_with_location = pd.DataFrame({'lon': Lon_data.flatten(),\n",
    "                                        'lat': Lat_data.flatten(),\n",
    "                                        'lftx': lftx_data.flatten()})\n",
    "lftx_data_with_location.head()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/envs/devc/lib/python3.8/site-packages/geopandas/geodataframe.py:1351: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  super().__setitem__(key, value)\n",
      "/opt/anaconda3/envs/devc/lib/python3.8/site-packages/geopandas/geodataframe.py:1351: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  super().__setitem__(key, value)\n"
     ]
    },
    {
     "data": {
      "text/plain": "Empty GeoDataFrame\nColumns: [adcode, name, geometry, lftx_value, num]\nIndex: []",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>adcode</th>\n      <th>name</th>\n      <th>geometry</th>\n      <th>lftx_value</th>\n      <th>num</th>\n    </tr>\n  </thead>\n  <tbody>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "map_value = chinamap_data[['adcode', 'name', 'geometry']]\n",
    "map_value['lftx_value'] = 0\n",
    "map_value['num'] = 0\n",
    "\n",
    "\n",
    "# map_value.head()\n",
    "\n",
    "def trans(lon):\n",
    "    \"\"\"\n",
    "\n",
    "    :param lon:\n",
    "    :return:\n",
    "    \"\"\"\n",
    "    if lon <= 180:\n",
    "        return lon\n",
    "    else:\n",
    "        return lon - 360\n",
    "\n",
    "\n",
    "# 这个代码非常重要\n",
    "# https://stackoverflow.com/questions/63955752/topologicalerror-the-operation-geosintersection-r-could-not-be-performed\n",
    "\n",
    "# map_value['geometry'] = map_value.buffer(0)\n",
    "\n",
    "\n",
    "\n",
    "map_value['geometry'] = map_value.buffer(0) #['geometry'].apply(lambda x: make_valid(x))\n",
    "map_value.loc[~map_value.is_valid]"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "  0%|          | 0/10512 [00:00<?, ?it/s]/opt/anaconda3/envs/devc/lib/python3.8/site-packages/geopandas/geodataframe.py:1351: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  super().__setitem__(key, value)\n",
      "100%|██████████| 10512/10512 [00:10<00:00, 958.63it/s] \n"
     ]
    }
   ],
   "source": [
    "\n",
    "for index in tqdm(range(lftx_data_with_location.shape[0])):\n",
    "    temp_df = lftx_data_with_location.iloc[index, :]\n",
    "\n",
    "    temp_mask = map_value['geometry'].contains(Point(trans(temp_df.lon),\n",
    "                                                     temp_df.lat))\n",
    "    map_value['lftx_value'] = map_value['lftx_value'] + temp_mask * temp_df.lftx\n",
    "\n",
    "    map_value['num'] = map_value['num'] + temp_mask * 1"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "outputs": [
    {
     "data": {
      "text/plain": "   adcode    name                                           geometry  \\\n0  110000     北京市  GEOMETRYCOLLECTION (POLYGON ((115.72068 39.551...   \n1  120000     天津市  GEOMETRYCOLLECTION (POLYGON ((117.85060 39.363...   \n2  130000     河北省  GEOMETRYCOLLECTION (MULTIPOLYGON (((117.80502 ...   \n3  140000     山西省  MULTIPOLYGON (((110.37926 34.60061, 110.42484 ...   \n4  150000  内蒙古自治区  POLYGON ((97.17290 42.79526, 97.37123 42.45708...   \n\n   lftx_value  num  mean_lftx  center_lon  center_lat  \n0    0.000000    0   0.000000  116.419926   40.188020  \n1    5.825000    1   5.825000  117.347635   39.284229  \n2   21.725000    3   7.241667  116.149012   39.546673  \n3   10.250000    2   5.125000  112.295479   37.572346  \n4  289.474996   20  14.473750  113.926033   44.089916  ",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>adcode</th>\n      <th>name</th>\n      <th>geometry</th>\n      <th>lftx_value</th>\n      <th>num</th>\n      <th>mean_lftx</th>\n      <th>center_lon</th>\n      <th>center_lat</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>110000</td>\n      <td>北京市</td>\n      <td>GEOMETRYCOLLECTION (POLYGON ((115.72068 39.551...</td>\n      <td>0.000000</td>\n      <td>0</td>\n      <td>0.000000</td>\n      <td>116.419926</td>\n      <td>40.188020</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>120000</td>\n      <td>天津市</td>\n      <td>GEOMETRYCOLLECTION (POLYGON ((117.85060 39.363...</td>\n      <td>5.825000</td>\n      <td>1</td>\n      <td>5.825000</td>\n      <td>117.347635</td>\n      <td>39.284229</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>130000</td>\n      <td>河北省</td>\n      <td>GEOMETRYCOLLECTION (MULTIPOLYGON (((117.80502 ...</td>\n      <td>21.725000</td>\n      <td>3</td>\n      <td>7.241667</td>\n      <td>116.149012</td>\n      <td>39.546673</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>140000</td>\n      <td>山西省</td>\n      <td>MULTIPOLYGON (((110.37926 34.60061, 110.42484 ...</td>\n      <td>10.250000</td>\n      <td>2</td>\n      <td>5.125000</td>\n      <td>112.295479</td>\n      <td>37.572346</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>150000</td>\n      <td>内蒙古自治区</td>\n      <td>POLYGON ((97.17290 42.79526, 97.37123 42.45708...</td>\n      <td>289.474996</td>\n      <td>20</td>\n      <td>14.473750</td>\n      <td>113.926033</td>\n      <td>44.089916</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "map_value['mean_lftx'] = map_value['lftx_value'] / map_value['num']  #(map_value['num'] + 0.00001)\n",
    "\n",
    "map_value.loc[pd.isna(map_value['mean_lftx']), 'mean_lftx'] = 0\n",
    "map_value.head()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 画图\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-109-af8b4bc84292>:13: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.\n",
      "\n",
      "  map_value['center_lon'] = map_value['geometry'].centroid.x\n",
      "<ipython-input-109-af8b4bc84292>:14: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.\n",
      "\n",
      "  map_value['center_lat'] = map_value['geometry'].centroid.y\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "# 检测系统\n",
    "import platform\n",
    "\n",
    "if platform.system() == 'Darwin':\n",
    "    plt.rcParams[\"font.family\"] = 'Arial Unicode MS'\n",
    "elif platform.system() == 'Windows':\n",
    "    plt.rcParams[\"font.family\"] = 'SimHei'\n",
    "else:\n",
    "    pass\n",
    "# Linux\n",
    "# Windows\n",
    "\n",
    "\n",
    "fig, ax = plt.subplots()\n",
    "\n",
    "map_value.plot(ax=ax, column='mean_lftx', legend=True)\n",
    "\n",
    "map_value['center_lon'] = map_value['geometry'].centroid.x\n",
    "map_value['center_lat'] = map_value['geometry'].centroid.y\n",
    "\n",
    "for index in range(map_value.shape[0]):\n",
    "    # ax.scatter(map_value['center_lon'], map_value['center_lat'])\n",
    "    temp_df = map_value.iloc[index, :]\n",
    "    ax.text(x=temp_df.center_lon, y=temp_df.center_lat, s=str(temp_df['name']))\n",
    "\n",
    "ax.set_title(\"demo 中国地图, 公众号：pypi\", fontdict={\"size\": 20})\n",
    "ax.autoscale()\n",
    "plt.tight_layout()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "outputs": [
    {
     "data": {
      "text/plain": "'Darwin'"
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "name": "python3",
   "language": "python",
   "display_name": "Python 3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}